<template>
	<view class="container">
		<view class="title-section">
			<view class="title-item">
				<text class="un-title">{{item.TITLE}}</text>
				<text class="un-title2 clamp">{{item.CREATEDATE}}</text>
			</view>
		</view>
		<view class="detail-section m-t">
			<text class="un-tit2">{{item.DETAIL}}</text>
			<text class="un-tit3" @click="navToLink(item.LINK)">{{item.LINK}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		components: {
		},
		data() {
			return {
				item:{},
			}
		},
		onLoad(options) {
			this.loadData(options.id);
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {  
			//加载公告
			async loadData(id){
					//加载信息
				this.$http.post("/ad/queryNewsDeatil",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					id:id,
				}).then((e)=>{
					this.item = e.data.OBJECT
				}).catch((err)=>{
					console.log("请求超时",err);
				})
			},
			navToLink(link){
				// window.location.href=link;
				link=link.substring(28);
				if(link=="/pages/category/category"||link=="/pages/exchange/exchange"||link=="/pages/cart/cart"||link=="/pages/user/user"){
					uni.switchTab({
						url:link
					})
				}else if(link=="/pages/index/index"||link=="/"){
					uni.switchTab({
						url:"/pages/index/index"
					})
				}else{
					uni.navigateTo({
						url:link
					})
					
				}
				
			}
		},
	}
</script>

<style lang="scss">
	page {
		background: #f5f5f5;
	}
	.m-t{
		margin-top: 5upx;
	}
	.title-section{
		display:flex;
		flex-wrap:wrap;
		padding: 0 50upx;
		background: #fff;
		.title-item{
			text-align: center;
			margin: 45upx;
			width: 100%;
			.un-title{
				font-size: 32upx;
			}
			.un-title2{
				color: $font-color-light;
				font-size: 28upx;
			}
		}
	}
	.detail-section{
		display:flex;
		flex-wrap:wrap;
		padding: 0 50upx;
		background: #fff;
		.un-tit2{
			color: $font-color-light;
			font-size: 24upx;
			line-height: 55upx;
			margin: 25upx;
		}
		.un-tit3{
			color:#0099FF;
			font-size: 24upx;
			line-height: 55upx;
			margin: 25upx;
		}
	}
	
	
	
	
</style>
